<template>
  <div>
    <el-card class="box-card">
  <div slot="header" class="clearfix">
    <span>用户详情</span>
    <el-button style="float: right; padding: 3px 0" type="text" @click="goBack">返回</el-button>
  </div>
  <div class="text item">
    <p>姓名：{{UserInfo.name}}</p>
    <p>年龄：{{UserInfo.age}}</p>
    <p>头衔：{{UserInfo.position}}</p>
  </div>
</el-card>
  </div>
</template>

<script>
export default {
    name:'UserDetail',
    props:['id'],
    data(){
        return{
            UserInfo:{}
        }
    },
    methods:{
      async getUserInfo(){
             const {data:res}= await this.$http.get('/api/users/'+this.id)
            //  console.log(res);
            this.UserInfo=res.data
        },
        goBack(){
            this.$router.go(-1)
        }
    },

    created(){
        this.getUserInfo()
    }

}
</script>

<style lang="less" scoped>

</style>